/**
 * Radon Router Rules Config File
 * -----------------------------------
 * 	rule item format
 * 		match	- 正则匹配
 * 		uri		- 字符串匹配
 * 		handler	- 响应处理函数, fn(uri, [matchs]), 返回字符串 module_name:event_name 或失败时返回false
 * 		module	- 目标模块名称
 * 		event	- 目标模块事件名称, match匹配模式时可以包含{$1}等宏标记
 *
 * 	example:
 {
	'match': /^API\/(.*)$/,
	'handler2': function(uri){
		return 'aapi:' + uri;
	},
	'module': 'test',
	'event': '{$1}'
},
 */
let rules =
{
	'rules': [
		//ws 的初始化
		{'uri':'APP/WEBSOCKET_INIT', 'module':'login', 'event':'webSocketInit'},
		//DSP登录
		{'uri':'WS/login', 			'module':'login', 'event':'login'},
		{'uri':'WS/logout', 		'module':'login', 'event':'logout'},
		{'uri':'WS/switchLogin', 	'module':'login', 'event':'switchLogin'},
		{'uri':'WS/adminLogin', 	'module':'login', 'event':'adminLogin'},
		//大数据查询的 模块的处理正则表达式:
		{
			'match': /^WS\/DSP\/(plan|whisky|sweety|creative|campaign|product)\/(trend|list)$/,
			'module': '{$1}' + '_query',
			'event': '{$2}'
		},

		// 业务
		{
			'match': /^WS\/DSP\/(deal|whisky|sweety|creative|product|campaign|plan|channelInfo)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},
		
		// 附带模块
		{
			'match': /^WS\/DSP\/(PDMP|condition|materialGroup|ptc|audit|monitor|blacklist)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},
		
		//有关广告位的处理正则表达式:
		{
			'match': /^WS\/DSP\/(adSubChannel|massMedia|massChannel|spot)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},
		
		// 维度
		{
			'match': /^WS\/DSP\/(account|overview|)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},

		//DSp用户相关的模块.
		{
			'match': /^WS\/DSP\/(user|userAccess|qualification)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},

		//有关财务处理正则表达式:
		{
			'match': /^WS\/DSP\/(premium|cost|bill|invoice|financeAudit)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},

		{
			'match': /^WS\/DSP\/(customDownload|error|category)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},

		//维度查询模块的处理正则表达式:
		{
			'match': /^WS\/DSP\/(groupDim|channel|terminal|region|trend|frequency|compare|channelCategory)\/(\w+)$/,
			'module': '{$1}',
			'event': '{$2}'
		},

		//产品接收用户中心的通知消息
		{'uri':'UC_API/comm', 'module':'dspClient', 'event':'uc.comm'},

		// 产品接受DSP_ADMIN的通知消息
		{'uri':'PRODUCT_API/admin', 'module':'dspClient', 'event':'admin.command'},

		//DSP产品内部的Sdk请求
		{'uri':'SDK/verifyTicket', 	'module':'dspClient', 'event':'verifyTicket'},
		{'uri':'SDK/switchUser', 	'module':'dspClient', 'event':'switchUser'},
		{'uri':'SDK/switchList', 	'module':'dspClient', 'event':'switchList'},
		{'uri':'SDK/logoutCas', 	'module':'dspClient', 'event':'logoutCas'},
		{'uri':'SDK/createAccount', 'module':'dspClient', 'event':'createAccount'},
		{'uri':'SDK/accountChange', 'module':'dspClient', 'event':'accountChange'},
		{'uri':'SDK/employeeOption', 'module':'dspClient', 'event':'employeeOption'},

		//审核系统配置的获取

		// 文件上传接口
		{'uri':'HTTP_API/upload', 'module':'upload', 'event':'upload'},
		// 秒传上传接口
		{'uri':'HTTP_API/fast_upload', 'module':'upload', 'event':'fastUpload'},
		//缩略图接口
		{'uri':'HTTP_API/thumb', 'module':'thumbnail', 'event':'thumb'},
		//返回用户的相关配置.
		{'uri':'HTTP_API/config', 'module':'user', 'event':'config'},
		//前端退出.
		{'uri':'HTTP_API/logout', 'module':'login', 'event':'http.logout'},
		//文件下载接口
		{
			'match':/^HTTP_API\/export\/(\w+)/,
			'module':'export',
			'event':'export'
		},
		//文件下载接口
		{
			'match':/^HTTP_API\/download\/(\w+)(\/(\w+))?(\S)*$/,
			'module':'download',
			'event':'download'
		},
		//预览接口
		{
			'match':/^HTTP_API\/preview\/(\w+)/,
			'module':'preview',
			'event':'preview'
		},
		//OEM script接口
		{
			'match':/^HTTP_API\/oem.js/,
			'module':'user',
			'event':'oem'
		},
		//获取相对路径文件 接口
		{
			'match':/^HTTP_API\/getMaterial/,
			'module':'preview',
			'event':'getMaterial'
		},

		//用户联系人接口
		{
			'match': /^WS\/DSP\/contact\/(\w+)(\/(\w+))?$/,
			'module': 'contact',
			'event': '{$1}'
		},

		{'uri':'premium/add', 			'module':'premium', 			'event':'add'},
		{'uri':'premium/info', 			'module':'premium', 			'event':'info'},
	]
}
return rules;

